package com.ruoyi.zhoubao.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zhoubao.domain.ReqZbTran24;
import com.ruoyi.zhoubao.service.IReqZbTran24Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * zhoubao24Controller
 * 
 * @author ruoyi
 * @date 2025-10-21
 */
@Controller
@RequestMapping("/zhoubao/tran24")
public class ReqZbTran24Controller extends BaseController
{
    private String prefix = "zhoubao/tran24";

    @Autowired
    private IReqZbTran24Service reqZbTran24Service;

    @RequiresPermissions("zhoubao:tran24:view")
    @GetMapping()
    public String tran24()
    {
        return prefix + "/tran24";
    }

    /**
     * 查询zhoubao24列表
     */
    @RequiresPermissions("zhoubao:tran24:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ReqZbTran24 reqZbTran24)
    {
        startPage();
        List<ReqZbTran24> list = reqZbTran24Service.selectReqZbTran24List(reqZbTran24);
        return getDataTable(list);
    }

    /**
     * 导出zhoubao24列表
     */
    @RequiresPermissions("zhoubao:tran24:export")
    @Log(title = "zhoubao24", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ReqZbTran24 reqZbTran24)
    {
        List<ReqZbTran24> list = reqZbTran24Service.selectReqZbTran24List(reqZbTran24);
        ExcelUtil<ReqZbTran24> util = new ExcelUtil<ReqZbTran24>(ReqZbTran24.class);
        return util.exportExcel(list, "zhoubao24数据");
    }

    /**
     * 新增zhoubao24
     */
    @RequiresPermissions("zhoubao:tran24:add")
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存zhoubao24
     */
    @RequiresPermissions("zhoubao:tran24:add")
    @Log(title = "zhoubao24", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ReqZbTran24 reqZbTran24)
    {
        return toAjax(reqZbTran24Service.insertReqZbTran24(reqZbTran24));
    }

    /**
     * 修改zhoubao24
     */
    @RequiresPermissions("zhoubao:tran24:edit")
    @GetMapping("/edit/{行别}")
    public String edit(@PathVariable("行别") String 行别, ModelMap mmap)
    {
        ReqZbTran24 reqZbTran24 = reqZbTran24Service.selectReqZbTran24By行别(行别);
        mmap.put("reqZbTran24", reqZbTran24);
        return prefix + "/edit";
    }

    /**
     * 修改保存zhoubao24
     */
    @RequiresPermissions("zhoubao:tran24:edit")
    @Log(title = "zhoubao24", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ReqZbTran24 reqZbTran24)
    {
        return toAjax(reqZbTran24Service.updateReqZbTran24(reqZbTran24));
    }

    /**
     * 删除zhoubao24
     */
    @RequiresPermissions("zhoubao:tran24:remove")
    @Log(title = "zhoubao24", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(reqZbTran24Service.deleteReqZbTran24By行别s(ids));
    }
}
